import {HTTP} from '../../utils/http.js'
let http = new HTTP()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    user: {
      type: Object,
      default: {}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    focusTap() {
      http.request({
        url: '/ai/draw/account/focus/account',
        data: {
          focusedAccountId: this.data.user.id
        },
        success: (res) => {
           if(res.code === "0") {
              this.triggerEvent('refreshUser')
           }
        }
      })
    },

    cancelFocusTap() {
      http.request({
        url: '/ai/draw/account/cancel/focus/account',
        data: {
          focusedAccountId: this.data.user.id
        },
        success: (res) => {
           if(res.code === "0") {
              this.triggerEvent('refreshUser')
           }
        }
      })
    },

    jumpUser() {
      wx.navigateTo({
        url: '/pages/user/user?userId=' + this.data.user.id,
      })
    }

  }
})
